﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ShangChengPanel : MonoBehaviour
{
    public Button GoldButton, LiBaoButton;
    public GameObject GoldGai, LiBaoGai, GoldParent, LiBaoParent;
    public Image LiBaoImage, GoldImage;
    public Button ErYuanButton, LiuYuanButton, ShiLiuYuanButton, SanShiBaYuanButton;//金币
    public Button SiShiYuanButton, WuShiyuanButton, QiShiYuanButton, JiuShiJiuYuanButton;//礼包
    void Start()
    {
        GoldButton.onClick.AddListener(OnClickGoldButton);
        LiBaoButton.onClick.AddListener(OnClickLiBaoButton);
        //ErYuanButton.onClick.AddListener(BuyGold2);
        //LiuYuanButton.onClick.AddListener(BuyGold6);
        //ShiLiuYuanButton.onClick.AddListener(BuyGold16);
        //SanShiBaYuanButton.onClick.AddListener(BuyGold38);
        //SiShiYuanButton.onClick.AddListener(BuyGold40);
        //WuShiyuanButton.onClick.AddListener(BuyGold50);
        //QiShiYuanButton.onClick.AddListener(BuyGold70);
        //JiuShiJiuYuanButton.onClick.AddListener(BuyGold99);


    }


    void Update()
    {

    }
    /// <summary>
    /// 点击金币按钮
    /// </summary>
    public void OnClickGoldButton()
    {
        ShortVoice.instance.PlayVoice("AnNiu");
        LiBaoGai.SetActive(true);
        GoldGai.SetActive(false);
        GoldImage.transform.SetParent(GoldParent.transform);
        LiBaoImage.transform.SetParent(LiBaoParent.transform);

    }
    /// <summary>
    /// 点击礼包按钮
    /// </summary>
    public void OnClickLiBaoButton()
    {
        ShortVoice.instance.PlayVoice("AnNiu");
        GoldGai.SetActive(true);
        LiBaoGai.SetActive(false);
        GoldImage.transform.SetParent(LiBaoParent.transform);
        LiBaoImage.transform.SetParent(GoldParent.transform);

    }
    /// <summary>
    /// 0.99
    /// </summary>
    public void BuyGold5000()
    {
        Debug.Log("BuyGold5000----成功");
        ShortVoice.instance.PlayVoice("AnNiu");
        //NeiGouManager.instance.BuyProductID("5000gold");
        DataManager.Instance.Gold += 5000;
        DataManager.Instance.Save();
        GoldAndLv.instance.GengXin();
    }
    /// <summary>
    /// 1.88
    /// </summary>
    public void BuyGold10000()
    {
        ShortVoice.instance.PlayVoice("AnNiu");
        DataManager.Instance.Gold += 10000;
        DataManager.Instance.Save();
        GoldAndLv.instance.GengXin();
    }
    /// <summary>
    /// 3.68
    /// </summary>
    public void BuyGold20000()
    {
        ShortVoice.instance.PlayVoice("AnNiu");
        DataManager.Instance.Gold += 20000;
        DataManager.Instance.Save();
        GoldAndLv.instance.GengXin();
    }
    /// <summary>
    /// 6.99
    /// </summary>
    public void BuyGold50000()
    {
        ShortVoice.instance.PlayVoice("AnNiu");
        DataManager.Instance.Gold += 50000;
        DataManager.Instance.Save();
        GoldAndLv.instance.GengXin();
    }
    /// <summary>
    /// 7.99
    /// </summary>
    public void BuyGold70000()
    {
        ShortVoice.instance.PlayVoice("AnNiu");
        DataManager.Instance.Gold += 70000;
        DataManager.Instance.Save();
        GoldAndLv.instance.GengXin();
    }
    /// <summary>
    /// 9.68
    /// </summary>
    public void BuyGold100000()
    {
        ShortVoice.instance.PlayVoice("AnNiu");
        DataManager.Instance.Gold += 100000;
        DataManager.Instance.Save();
        GoldAndLv.instance.GengXin();
    }
    /// <summary>
    /// 11.99
    /// </summary>
    public void BuyGold150000()
    {
        ShortVoice.instance.PlayVoice("AnNiu");
        DataManager.Instance.Gold += 150000;
        DataManager.Instance.Save();
        GoldAndLv.instance.GengXin();
    }
    /// <summary>
    /// 13.99
    /// </summary>
    public void BuyGold200000()
    {
        ShortVoice.instance.PlayVoice("AnNiu");
        DataManager.Instance.Gold += 200000;
        DataManager.Instance.Save();
        GoldAndLv.instance.GengXin();
    }

}
